﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.EditorScreen
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine.Bindings;
using UnityEngine.Internal;

#nullable disable
namespace UnityEngine
{
  [NativeHeader("Runtime/Graphics/GraphicsScriptBindings.h")]
  [NativeHeader("Runtime/Graphics/ScreenManager.h")]
  [NativeHeader("Runtime/Graphics/WindowLayout.h")]
  [StaticAccessor("GetScreenManager()", StaticAccessorType.Dot)]
  internal sealed class EditorScreen
  {
    public static extern int width { [NativeMethod(Name = "GetWidth", IsThreadSafe = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    public static extern int height { [NativeMethod(Name = "GetHeight", IsThreadSafe = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    public static extern float dpi { [NativeName("GetDPI"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void RequestOrientation(ScreenOrientation orient);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern ScreenOrientation GetScreenOrientation();

    public static ScreenOrientation orientation
    {
      get => EditorScreen.GetScreenOrientation();
      set
      {
        if (value == ScreenOrientation.Unknown)
        {
          Debug.Log((object) "ScreenOrientation.Unknown is deprecated. Please use ScreenOrientation.AutoRotation");
          value = ScreenOrientation.AutoRotation;
        }
        EditorScreen.RequestOrientation(value);
      }
    }

    [NativeProperty("ScreenTimeout")]
    public static extern int sleepTimeout { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    [NativeName("GetIsOrientationEnabled")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool IsOrientationEnabled(EnabledOrientation orient);

    [NativeName("SetIsOrientationEnabled")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetOrientationEnabled(EnabledOrientation orient, bool enabled);

    public static bool autorotateToPortrait
    {
      get => EditorScreen.IsOrientationEnabled(EnabledOrientation.kAutorotateToPortrait);
      set => EditorScreen.SetOrientationEnabled(EnabledOrientation.kAutorotateToPortrait, value);
    }

    public static bool autorotateToPortraitUpsideDown
    {
      get => EditorScreen.IsOrientationEnabled(EnabledOrientation.kAutorotateToPortraitUpsideDown);
      set
      {
        EditorScreen.SetOrientationEnabled(EnabledOrientation.kAutorotateToPortraitUpsideDown, value);
      }
    }

    public static bool autorotateToLandscapeLeft
    {
      get => EditorScreen.IsOrientationEnabled(EnabledOrientation.kAutorotateToLandscapeLeft);
      set
      {
        EditorScreen.SetOrientationEnabled(EnabledOrientation.kAutorotateToLandscapeLeft, value);
      }
    }

    public static bool autorotateToLandscapeRight
    {
      get => EditorScreen.IsOrientationEnabled(EnabledOrientation.kAutorotateToLandscapeRight);
      set
      {
        EditorScreen.SetOrientationEnabled(EnabledOrientation.kAutorotateToLandscapeRight, value);
      }
    }

    public static Resolution currentResolution
    {
      get
      {
        Resolution ret;
        EditorScreen.get_currentResolution_Injected(out ret);
        return ret;
      }
    }

    public static extern bool fullScreen { [NativeName("IsFullscreen"), MethodImpl(MethodImplOptions.InternalCall)] get; [NativeName("RequestSetFullscreenFromScript"), MethodImpl(MethodImplOptions.InternalCall)] set; }

    public static extern FullScreenMode fullScreenMode { [NativeName("GetFullscreenMode"), MethodImpl(MethodImplOptions.InternalCall)] get; [NativeName("RequestSetFullscreenModeFromScript"), MethodImpl(MethodImplOptions.InternalCall)] set; }

    public static Rect safeArea
    {
      get
      {
        Rect ret;
        EditorScreen.get_safeArea_Injected(out ret);
        return ret;
      }
    }

    public static extern Rect[] cutouts { [FreeFunction("ScreenScripting::GetCutouts"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    [NativeName("RequestResolution")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void SetResolution(
      int width,
      int height,
      FullScreenMode fullscreenMode,
      [DefaultValue("0")] int preferredRefreshRate);

    public static void SetResolution(int width, int height, FullScreenMode fullscreenMode)
    {
      EditorScreen.SetResolution(width, height, fullscreenMode, 0);
    }

    public static void SetResolution(
      int width,
      int height,
      bool fullscreen,
      [DefaultValue("0")] int preferredRefreshRate)
    {
      EditorScreen.SetResolution(width, height, fullscreen ? FullScreenMode.FullScreenWindow : FullScreenMode.Windowed, preferredRefreshRate);
    }

    public static void SetResolution(int width, int height, bool fullscreen)
    {
      EditorScreen.SetResolution(width, height, fullscreen, 0);
    }

    public static Vector2Int mainWindowPosition => EditorScreen.GetMainWindowPosition();

    public static DisplayInfo mainWindowDisplayInfo => EditorScreen.GetMainWindowDisplayInfo();

    public static void GetDisplayLayout(List<DisplayInfo> displayLayout)
    {
      if (displayLayout == null)
        throw new ArgumentNullException();
      EditorScreen.GetDisplayLayoutImpl(displayLayout);
    }

    public static AsyncOperation MoveMainWindowTo(in DisplayInfo display, Vector2Int position)
    {
      return EditorScreen.MoveMainWindowImpl(in display, position);
    }

    [FreeFunction("GetMainWindowPosition")]
    private static Vector2Int GetMainWindowPosition()
    {
      Vector2Int ret;
      EditorScreen.GetMainWindowPosition_Injected(out ret);
      return ret;
    }

    [FreeFunction("GetMainWindowDisplayInfo")]
    private static DisplayInfo GetMainWindowDisplayInfo()
    {
      DisplayInfo ret;
      EditorScreen.GetMainWindowDisplayInfo_Injected(out ret);
      return ret;
    }

    [FreeFunction("GetDisplayLayout")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetDisplayLayoutImpl(List<DisplayInfo> displayLayout);

    [FreeFunction("MoveMainWindow")]
    private static AsyncOperation MoveMainWindowImpl(in DisplayInfo display, Vector2Int position)
    {
      return EditorScreen.MoveMainWindowImpl_Injected(in display, ref position);
    }

    public static extern Resolution[] resolutions { [FreeFunction("ScreenScripting::GetResolutions"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    public static extern float brightness { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void get_currentResolution_Injected(out Resolution ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void get_safeArea_Injected(out Rect ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetMainWindowPosition_Injected(out Vector2Int ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetMainWindowDisplayInfo_Injected(out DisplayInfo ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern AsyncOperation MoveMainWindowImpl_Injected(
      in DisplayInfo display,
      ref Vector2Int position);
  }
}
